package com.otherTest.designpattern.creationalpattern.singleton.checkin;

/**
 * @Description: 登记式单例模式/静态内部类
 * 是懒加载，是线程安全
 * @author: conceit
 * @Date: 2018/8/30 0030 15:22
 */
public class SingleCheckInBaseObject {

    /**
     * 静态内部类
     */
    private static class SingleCheckInBaseObjectHolder {
        /**
         * 静态内部类方法
         */
        private static final SingleCheckInBaseObject INSTANCE = new SingleCheckInBaseObject();

    }

    /**
     * 私有化构造方法
     */
    private SingleCheckInBaseObject() {
    }

    ;

    /**
     * 从静态内部类返回对象
     */
    public static SingleCheckInBaseObject getInstance() {
        return SingleCheckInBaseObjectHolder.INSTANCE;
    }

    /**
     * 测试方法
     */
    public void showMessage() {
        System.out.println(this.getClass().getName() + "--->this is showMessage");
    }
}
